import dayjs from "dayjs";

export class Date {
  static ftYear = "YYYY";
  static ftMonth = `${Date.ftYear}-MM`;
  static ftDate = `${Date.ftMonth}-DD`;

  static get timestamp() {
    return dayjs().unix();
  }

  static getCurrentDate(ft = Date.ftMonth) {
    return dayjs().format(ft);
  }

  static getDate(date?: string | number | dayjs.Dayjs | undefined) {
    return dayjs(date);
  }

  static minuteToNum(minute: string) {
    const [m, s] = minute.split(":");
    return Number(m) * 60 + Number(s);
  }
}
